package cn.lingyangwl.agile.model.module.mq;

import lombok.*;

/**
 * oauth2 client 客户端刷新, 用于更改客户端角色以及更新角色权限刷新网关本地缓存的客户端权限
 *
 * @author shenguangyang
 */
public class OAuth2ClientMQ extends AbstractMQ {
    public static final String EXCHANGE = "auth.oauth2_client";


    public OAuth2ClientMQ(OAuth2ClientMQ.MsgPayload msgPayload) {
        super(msgPayload);
    }

    @Data
    @Builder
    @EqualsAndHashCode(callSuper = true)
    @AllArgsConstructor
    @NoArgsConstructor
    public static class MsgPayload extends BaseMqPayload {
        /**
         * 配置的客户端id
         */
        private String clientId;

        public String toMessage() {
            return new OAuth2ClientMQ(this).toMessage();
        }
    }

    public static MsgPayload build(String clientId){
        return new MsgPayload(clientId);
    }
}
